﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConceptsFramework.Containers.Generic;

namespace PatternExplorer.DerivedConcepts
{
    public class MultipleGenericTypeSummary : TypeSummary
    {
        private BindableConceptContainer<MultipleGenericParametersSummary> GenericParameterVariations;

        public MultipleGenericTypeSummary()
        {
            GenericParameterVariations = new BindableConceptContainer<MultipleGenericParametersSummary>();
            GenericParameterVariations.ConceptKeyRetriever = a => a.GenericArgumentTypesDescription;
            GenericParameterVariations.ParentConcept = this;
        }

        /// <summary>
        /// Defines the generic argument type declared in the generic class definition
        /// </summary>
        public List<string> BaseGenericArgumentTypes
        {
            get;
            set;
        }

        public MultipleGenericParametersSummary GetGenericTypeVariation(List<string> GenericParameterTypes)
        {

            MultipleGenericParametersSummary aMultipleGenericTypeSummary = new MultipleGenericParametersSummary();
            aMultipleGenericTypeSummary.BaseGenericArgumentTypes = this.BaseGenericArgumentTypes;
            aMultipleGenericTypeSummary.GenericArgumentTypes = GenericParameterTypes;
            if (!GenericParameterVariations.Contains(aMultipleGenericTypeSummary.GenericArgumentTypesDescription))
            {
                GenericParameterVariations.Add(aMultipleGenericTypeSummary);
            }
            return GenericParameterVariations.Container[aMultipleGenericTypeSummary.GenericArgumentTypesDescription];
        }
    }
}
